<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <style>
        .float-wrapper {
            margin: 20px;
            border: 1px solid #000;
            overflow: hidden;
        }
        .float-wrapper__box{
            width: 100px;
            height: 120px;
            background: magenta;
            float: right;
        }
    </style>
    <section class="float-wrapper">
        <div class="float-wrapper__box"></div>
    </section>
    <style>
        .pos-wrapper{
            margin: 20px;
            border: 1px solid #000000;
            height: 200px;
            position: relative;
        }
        .pos-wrapper__box{
            width: 50px;
            height: 60px;
            background: aqua;
            border: 1px solid #000000;
        }
        .pos-wrapper__box-r {
            position: relative;
            top: 20px;
            right: 20px;
        }
        .pos-wrapper__box-a {
            position: absolute;
            right: 0;
        }
    </style>
    <section class="pos-wrapper">
        <span>1</span>
        <div class="pos-wrapper__box pos-wrapper__box-r">relative</div>
        <div class="pos-wrapper__box pos-wrapper__box-a">absolute</div>
    </section>
    <style>
        .transform-wrapper {
            height: 400px;
            margin: 20px;
            border: 1px solid #000000;
            position: relative;
            perspective: 3000px;
            perspective-origin: 50% 50%;

        }
        .transform-wrapper__box {
            width: 100px;
            height: 100px;
            border: 1px solid #000000;
            background: aquamarine;
        }
        .transform-wrapper__box-translate {
            transform: translate3d(100px, 100px, 0);
            transform: rotate3d(1, 0, 0, 90deg);
            transform-style: preserve-3d;
        }
    </style>
    <section class="transform-wrapper">
        <span>666</span>
        <div class="transform-wrapper__box transform-wrapper__box-translate"></div>
        <span>2</span>
<!--        <div class="transform-wrapper__box" style="position: absolute;top:0;left: 0"></div>-->
    </section>
    <style>
        .stage-area{
            border: 1px solid #000000;
            margin: 20px;
            min-height: 100px;
            width: 900px;
            position: relative;
            perspective: 1000px;
            perspective-origin: 50% -20%;
            padding-bottom: 400px;
        }
        .stage-area__container{
            width: 128px;
            height: 100px;
            margin: 0 -64px;
            position: absolute;
            left: 50%;
            transform-style: preserve-3d;
            animation: move 10s linear;
        }
        .stage-area__container__piece {
            width: 128px;
            position: absolute;
            bottom: 0;
            backface-visibility: visible;
        }
        @keyframes move {
            from {
                transform: rotate3d(0, 1, 0, 0);
            }
            to {
                transform: rotate3d(0, 1, 0, -720deg);
            }
        }
    </style>
    <section class="stage-area">
        <div class="stage-area__container">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
            <img class="stage-area__container__piece" src="https://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" alt="">
        </div>
    </section>
    <script>
        const list = document.querySelectorAll('.stage-area__container__piece')
        const len = list.length
        const rotate = 360 / len
        const minZ = 128/2 / Math.tan((rotate/2/180) * Math.PI )
        list.forEach((item, i, arr) => {
            console.log(i)
            item.style = `transform: rotateY(${-rotate * i}deg) translateZ(${minZ + 20}px)`
        })
    </script>
</body>
</html>
